parser grammar FormalParser;

import SpecializedGrammar;

options {
	superClass = CycloneParserBase;
	tokenVocab = CommonLexer;
}

@parser::preinclude{
#include <string>
#include <optional>
#include "../cyclone_parser_base.h"
#include "../syntax_error_formatter.hpp"
}

@parser::postinclude {
using boolean = bool;
using CppString = std::string;
using namespace cyclone::parser;
}

@parser::context {
//TODO
}


@parser::members {
/* public parser declarations/members section */

void updateOperatorIsPrefix(antlr4::ParserRuleContext* context){
    if(auto updateOperator = dynamic_cast<UpdateOperatorContext*>(context))
        updateOperator->prefix = true;
}
}

// Appears in the public part of the parser in the h file.
@parser::declarations {/* private parser declarations section */}

// Appears in line with the other class member definitions in the cpp file.
@parser::definitions {/* parser definitions section */}

